% igetb.m

% gets b, given a, x, and sig
% also gets bNs
% b_t = [Sum_i (y_it -a_t)x_i] / [Sum_i x_i^2]

for q=1:kb,
  if bbon(q+ka) == 1,
    tind = find(t== BeginYear-1+q); % First year is BeginYear
    tind1 = zeros(Ns,1);
    tind1(tind)=OneNs(tind);
    Sumb = tind1'*(xNs.*(y-aNs));;
    Sumx = (tind1.*xNs)'*xNs;
    b(q) = Sumb/Sumx;
  end;
end;

igetbns;
